<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>15-filter</title>
</head>
<body>
    <script>
        // filter 筛选数组元素
        const arr = [10, 20, 30, 40]
        // const newArr = arr.filter(function(e,i){
        //     // console.log(e) // 数组元素
        //     // console.log(i) // 索引 0 1 2 3
        //     // return 筛选条件
        //     return e >= 30
        // })
        // console.log(newArr) // [30, 40]

        const newArr = arr.filter(e => e >= 30)
        console.log(newArr) // [30, 40]
        
        
    </script>
</body>
</html>